;--------------------------------------
;
; readf.asm
; 
; read file via DOS
;

;--------------------------------------
;
; include defs, prototypes and macros
;

include tab6.inc

;--------------------------------------
;
; begin code segment
;

	.CODE

readFile PROC PASCAL USES ds dx es di bx cx,filename:PBYTE,handle:WORD,bytes_read:WORD

; read file DOS function to ah

        mov     ah,3fh

; read specified number of bytes

        mov     cx,bytes_read

; place file handle in bx

        mov     bx,handle

; ds:dx points to filename

        IF mdl eq 3
        lds     dx,filename
        ELSE
        mov     dx,filename
        ENDIF

; read file via int 21h

        int     21h

; carry set on error / branch on error

        jc      dos_error

; no error and ax returns bytes read

        ret

; error code via ax

dos_error:
        neg     ax

        ret

readFile ENDP

        END

;
; end of readf.asm
;--------------------------------------



